const fs=require('fs');
const path=require('path');

let pathname=path.join(__dirname,"hello.txt");
// 异步写入文件：writeFile(pathname,写入的内容,'文件格式',错误回调函数);
fs.writeFile(pathname,"我是异步写入的文件",'utf-8',(error)=>{
  if(error){
    console.log(error);
    return
  }
console.log("写入成功！");
});